import os
import subprocess

def is_git_repo(path):
    return os.path.isdir(os.path.join(path, '.git'))

def git_pull(path):
    try:
        subprocess.run(['git', '-C', path, 'pull'], check=True)
        print(f"成功更新仓库: {path}")
    except subprocess.CalledProcessError:
        print(f"更新仓库失败: {path}")

def main():
    current_dir = os.getcwd()
    for item in os.listdir(current_dir):
        item_path = os.path.join(current_dir, item)
        if os.path.isdir(item_path):
            if is_git_repo(item_path):
                git_pull(item_path)
            else:
                print(f"不是Git仓库: {item_path}")

if __name__ == "__main__":
    main()